package models_main

import (
	"fmt"
	"longmen/server/pkg/db/mysql/models"
	"time"
)

type UserTask struct {
	Id         int
	Uid        uint
	TaskId     uint8
	Stage      uint8
	IsReceived uint8
	CreatedAt  time.Time `gorm:"column:create_time"`
	DoAt       time.Time `gorm:"column:task_time"` //对应task_time列，此处模仿花式命名
	Lock       bool      `json:"-" gorm:"-"`
}

func (UserTask) TableName() string {
	return fmt.Sprintf("%suser_task", models.Prefix)
}

func (s UserTask) Unlock() {
	s.Lock = false
}
